package com.example.likegifmarker.controller.fragments;

import android.app.Activity;
import android.graphics.Color;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.widget.Toolbar;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.viewpager.widget.ViewPager;

import com.bumptech.glide.Glide;
import com.example.likegifmarker.R;
import com.example.likegifmarker.controller.activities.MainActivity;
import com.google.android.material.appbar.AppBarLayout;
import com.kk.utils.ScreenUtil;

import net.lucode.hackware.magicindicator.MagicIndicator;

import butterknife.BindView;

import static com.example.likegifmarker.controller.activities.BaseActivity.setAndroidNativeLightStatusBar;

/*
 * Created by　Dullyoung on 2020/12/15
 */
public class MyFragment extends BaseFragment {
    @BindView(R.id.iv_bg)
    ImageView mIvBg;
    @BindView(R.id.iv_user_icon)
    ImageView mIvUserIcon;
    @BindView(R.id.tv_user_name)
    TextView mTvUserName;
    @BindView(R.id.tv_user_id)
    TextView mTvUserId;
    @BindView(R.id.tv_sign)
    TextView mTvSign;
    @BindView(R.id.tv_sex)
    TextView mTvSex;
    @BindView(R.id.tv_tab)
    TextView mTvTab;
    @BindView(R.id.tv_city)
    TextView mTvCity;
    @BindView(R.id.tv_fans)
    TextView mTvFans;
    @BindView(R.id.tv_sub)
    TextView mTvSub;
    @BindView(R.id.tv_like)
    TextView mTvLike;
    @BindView(R.id.ll_fans)
    LinearLayout mLlFans;
    @BindView(R.id.ll_add)
    LinearLayout mLlAdd;
    @BindView(R.id.cl_content)
    ConstraintLayout mClContent;
    @BindView(R.id.tv_center_user_name)
    TextView mTvCenterUserName;
    @BindView(R.id.cl_title)
    ConstraintLayout mClTitle;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.mi_vp_title)
    MagicIndicator mMiVpTitle;
    @BindView(R.id.app_bar)
    AppBarLayout mAppBar;
    @BindView(R.id.vp_rank)
    ViewPager mVpRank;
    @BindView(R.id.iv_share)
    ImageView mIvShare;
    @BindView(R.id.iv_more)
    ImageView mIvMore;

    public MyFragment() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_my;
    }

    @Override
    protected void initViews() {
        MainActivity mainActivity = (MainActivity) getActivity();
        setAndroidNativeLightStatusBar(mainActivity,false);
        Glide.with(getContext())
                .load(R.mipmap.app_icon)
                .circleCrop()
                .into(mIvUserIcon);
        mAppBar.addOnOffsetChangedListener((appBarLayout, i) -> {
            setAndroidNativeLightStatusBar(mainActivity, i != 0);
            if (Math.abs(i) > ScreenUtil.dip2px(getContext(), 131)) {
                mToolbar.setVisibility(View.VISIBLE);
            } else {
                mToolbar.setVisibility(View.INVISIBLE);
            }
        });
    }


}
